package chap6.homework13;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;

public class Task1 {
    public static void main(String[] args) throws IOException {
        HashMap<Integer,String> hashMap=new HashMap<Integer,String>();
        hashMap.put(1,"a");
        hashMap.put(2,"b");
        hashMap.put(3,"c");
        hashMap.put(4,"d");
        BufferedWriter buf=new BufferedWriter(new FileWriter("pan.txt"));
        Iterator iterator=hashMap.keySet().iterator();
        while(iterator.hasNext()){
            Integer key=(Integer) iterator.next();
            String value=hashMap.get(key);
            buf.write(key+","+value);
            buf.newLine();
            System.out.println(key+""+value);
        }
        buf.close();
    }
}
